Class NewsRepositoryTest

java.lang.Object
com.fsf.news.repository.NewsRepositoryTest

@ExtendWith(GuiceExtension.class) @ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class) class NewsRepositoryTest extends Object
Unit tests for the NewsRepository class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) com.fasterxml.jackson.databind.ObjectMapper
     
    (package private) com.fsf.news.repository.NewsRepository
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Tests that the findAll method returns the expected search results when available.
    (package private) void
    Tests that the findAllArticles method returns the expected articles when available.
    (package private) void
    Tests that the findAllArticles method returns an empty list when searching for articles in a different session.
    (package private) void
    Tests that the findAllArticles method returns an empty list when no articles are available.
    (package private) void
    Tests that the findAll method returns the expected search results when the maximum capacity is exceeded.
    (package private) void
    Tests that the findAll method returns an empty list when searching for search results in a different session.
    (package private) void
    Tests that the findAll method returns an empty list when no search results are available.
    (package private) void
    Tests that the findAll method returns the expected search results when the maximum capacity is reached.
    (package private) void
    Tests that the findByUuid method returns the expected search result when available.
    (package private) void
    Tests that the findByUuid method returns an empty optional when searching for a search result in a different session.
    (package private) void
    Tests that the findByUuid method returns an empty optional when no search result is available.
    (package private) void
    Tests that the save method adds a search result and returns the expected search result.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • objectMapper

      @Inject @Named("objectMapperJSON") com.fasterxml.jackson.databind.ObjectMapper objectMapper
    • repository

      @InjectMocks com.fsf.news.repository.NewsRepository repository
  • Constructor Details

    • NewsRepositoryTest

      NewsRepositoryTest()
  • Method Details

    • testFindByUuidEmpty

      @Test void testFindByUuidEmpty()
      Tests that the findByUuid method returns an empty optional when no search result is available.
    • testFindByUuid

      @Test void testFindByUuid()
      Tests that the findByUuid method returns the expected search result when available.
    • testFindByUuidDifferentSession

      @Test void testFindByUuidDifferentSession()
      Tests that the findByUuid method returns an empty optional when searching for a search result in a different session.
    • testFindAllEmpty

      @Test void testFindAllEmpty()
      Tests that the findAll method returns an empty list when no search results are available.
    • testFindAll

      @Test void testFindAll()
      Tests that the findAll method returns the expected search results when available.
    • testFindAllDifferentSession

      @Test void testFindAllDifferentSession()
      Tests that the findAll method returns an empty list when searching for search results in a different session.
    • testFindAllMaxCapacity

      @Test void testFindAllMaxCapacity()
      Tests that the findAll method returns the expected search results when the maximum capacity is reached.
    • testFindAllBeyondCapacity

      @Test void testFindAllBeyondCapacity()
      Tests that the findAll method returns the expected search results when the maximum capacity is exceeded.
    • testFindAllArticlesEmpty

      @Test void testFindAllArticlesEmpty()
      Tests that the findAllArticles method returns an empty list when no articles are available.
    • testFindAllArticles

      @Test void testFindAllArticles() throws IOException
      Tests that the findAllArticles method returns the expected articles when available.
      Throws:
      IOException - If an I/O error occurs
    • testFindAllArticlesDifferentSession

      @Test void testFindAllArticlesDifferentSession() throws IOException
      Tests that the findAllArticles method returns an empty list when searching for articles in a different session.
      Throws:
      IOException - If an I/O error occurs
    • testSave

      @Test void testSave()
      Tests that the save method adds a search result and returns the expected search result.